#ifndef FRAME_H
#define FRAME_H

#include "qtmetamacros.h"
#include "qtypes.h"
#include <QObject>
#include <qglobal.h>

class Frame : public QObject
{
    Q_OBJECT

  private:
    qint32 id;
    qint32 size;

  public:
    explicit Frame(QObject *parent = nullptr);
    explicit Frame(qint32 id, qint32 size, QObject *parent = nullptr);
    virtual ~Frame() = 0;
    virtual QByteArray EncodeToBytes() const = 0;
    virtual void DecodeFromBytes(const QByteArray &bytes) = 0;
    virtual QString GetFrameName() const = 0;
    qint32 Id() const;
    qint32 Size() const;
    void NotifyLocalChange();
    void NotifyRemoteChange();
    static qint32 PeekFrameID(const QByteArray &bytes);
    static QByteArray WrapFrame(const Frame &frame);
  signals:
    void OnFrameChangedByLocal();
    void OnFrameChangedByRemote();
};

#endif // FRAME_H
